<?php

class ReceiveInviteToAddCluster {

    function ReceiveInviteToAddCluster() {
    }
    
    private $message = "";
    
    public function run() {
    	//$this->message =  "1";
		//return ;
    	$blacklist = new Blacklist();
		if ($blacklist->isInBlacklist()) {
			$this->message = "0:黑名单用户~~";
			return;
		}
		
		$ret = DB :: LimitQuery('td_normal_user_info', array (
			'condition' => array (
				'qq' => $_POST[Sender]
			)
		), false);
		/*if(count($ret)==0) {
			$this->message = "0:无效的用户~~";
			return;
		}*/
		if($ret[0][is_friend]==0) {
			$this->message = "0:非好友不能邀请入群~~";
			return;
		}
		
		if($ret[0][invite_time]<=0) {
			$this->message = "0:邀请名额已经用完了~~";
			return;
		}
    	//$this->message =  "1";//":暂时不开放加群~";
		@ DB :: Query("update td_normal_user_info set `invite_time`=invite_time-1 where qq={$_POST[Sender]}  and is_blacklist=0");
		$this->message =  "1";
	}
	
	private function __get($property_name) {
		return $this-> $property_name;
	}

	private function __set($property_name, $value) {
		$this->$property_name = $value;
	}
}
?>